import unittest
import time
from BeautifulReport import BeautifulReport
from config.config import CASES_PATH, REPORTS_PATH

# 1.创建测试套件并加载用例
suite = unittest.defaultTestLoader.discover(CASES_PATH, pattern='test_*.py')

# 2.打印测试用例数量，确认是否加载了测试用例
print(f"找到 {suite.countTestCases()} 个测试用例")

# 3.生成报告
result = BeautifulReport(suite)
if __name__ == '__main__':
    # 4.执行器运行
    result.report(
        description="下厨房App测试报告",
        report_dir=REPORTS_PATH,
        filename=time.strftime("测试报告%Y年%m月%d日-%H时%M分%S秒"),
        theme="theme_cyan"
    )